# 元祖 ,不支持增删改 ,一个元素末尾必须增加,
tua = (123,)
print(type(tua))

tua1 = (123, 653, 235)
print(tua1[2])

# 应用场景
# 函数的参数和返回值
# 格式化输出本质上就是元祖
# 数据不能被修改的时候

# 字典
print("++++++++++++++++++++字典++++++++++++++++++++++")
# 定义空字典
dic = {}

dict = {
    "a": "q",
    "v": "a"
}
print(dict["v"])
print(dict.get("a"))
print(dict)

print("字典修改")

dict["a"] = "qqq"
dict["a1"] = "qqq"
print(dict)

print("删除字典key")
dict.pop("a")
print(dict)

print("字典键值对数量:%d" % len(dict), sep="\t")

for i in dict.items():
    print(i)

print("++++++++++++++++++++集合++++++++++++++++++++++")
# 定义空集合
coll = set()
# 集合是无序的 ,每个值是唯一的 数字每次的排序是一样的,字符串是不一样的
set = {21, 23, 21, 98, 7, 6}
set2 = {"aa", "das", "ee", "cc"}
print(set)
print(set2)
# 只能添加和删除
# add 添加的是一个整体
set.add(90)
set.add((123, 456, 67))
print(set)

# 分散添加
set.update((111, 222, 333))
print(set)

# 将一个集合添加到另一个集合 使用 update,不能用add
set.update(set2)
print(set)

# 删除
set.remove(21)
print(set)
# 删除
set.discard(111)
print(set)

# 交集和并集
print("+++++++++++++交集和并集++++++++++++++")
set3 = {11, 22, 33, 44}
set4 = {11, 22, 331, 441}
print("交集:%s" % (set3 & set4))
print("并集:%s" % (set3 | set4))
